package com.woniu.tank.bullet;


import com.woniu.tank.boom.Boom;
import com.woniu.tank.tank.BadTank;
import com.woniu.tank.ui.GamePanel;

public class GoodBullet extends Bullet  {

	//重写父类方法,玩家子弹打死敌军
	@Override
	public void collision(int[][] map){
		super.collision(map);
		for(int i=0;i<GamePanel.tanktk.size();i++){
			BadTank bad = GamePanel.tanktk.get(i);
			if(bad.y== y && bad.x== x){
				bad.isDrawTank=false;
				this.live =false;
				GamePanel.gbbullet.remove(this);
				GamePanel.tanktk.remove(i);
				GamePanel.boomtk.add(new Boom(x,y, tc));
			}
		}
		//好子弹与坏子弹碰撞
		for(int j=0;j<GamePanel.bbullet.size();j++){
			BadBullet bb = GamePanel.bbullet.get(j);
			if(bb.x==x&&bb.y==y){
				bb.live = false;
				this.live= false;
				GamePanel.gbbullet.remove(this);
				GamePanel.bbullet.remove(j);
			}
		}
	}
	public GoodBullet(int x, int y, int dir, GamePanel tc) {
		super(x, y, dir, tc);
	}
	public GoodBullet() {
		super();

	}

}
